<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <style>
        div {
            width: 500px;
            margin: 30px auto;
        }

        select {
            width: 100px;
        }
    </style>


</head>

<body>

    <div>
        <select name="" id="province">
            <option value="0">选择省</option>
            <option value="1">湖北</option>
            <option value="2">湖南</option>
        </select>
        <select name="" id="city">
            <option value="0">选择市</option>
        </select>
    </div>
    <script>
        let province = document.getElementById('province');
        let city = document.getElementById('city');
        province.onchange = function () {
            let tmp = province.options[province.selectedIndex].value;
            switch (tmp) {
                case "0":
                    city.innerHTML = '';
                    op = createop('0', '选择市')
                    city.append(op);
                    break;
                case "1":
                    city.innerHTML = '';
                    op = createop('1', '武汉')
                    city.append(op);
                    op = createop('2', '黄冈')
                    city.append(op);
                    break;
                case "2":
                    city.innerHTML = '';
                    op = createop('1', '长沙')
                    city.append(op);
                    op = createop('2', '湘潭')
                    city.append(op);
                    break;
            }
        }

        function createop(val, txt) {
            op = document.createElement('option');
            op.value = val;
            op.innerHTML = txt;
            return op;
        }
    </script>

</body>

</html>